  <div class="member-main">
  <div>

<div class="title" style="border-bottom:1px solid #ddd"><{t}>个人信息<{/t}><span class="disc"><{t}>| 请尽量完整填写您的个人信息，方便店家与您联系。<{/t}></span></div>
<form method="post" action="<{link app=b2c ctl='site_member'  full='1' act='save_setting'}> " id='form_saveMember' class="section">
<div class="FormWrap" style="background:none; border:none; padding:0; margin:0;">
<div class="division" style="border:none;margin-bottom:0">
<table class="forform" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th><{t}>货币：<{/t}></th>
    <td>
        <{input type=select name="currency" options=$currency.options value=$currency.value required=true}>
    </td>
  </tr>

   <tr>
    <th>E-mail：</th>
    <td>
        <{input type='text' name='contact[email]' value=$email  vtype="required&&email"}>
    </td>
  </tr>

</table>
</div>

<div class="division" style="border:none;padding-top:0; border-bottom:1px dashed #ddd">
<table class="forform" width="100%" border="0" cellspacing="0" cellpadding="0">
   <{foreach from=$attr item=item name="item" key='row'}>
  <tr>
  <th><{if $item.attr_required eq 'true'}><em>*</em><{/if}><{$item.attr_name}></th>
  <td>

  <{if $item.attr_type =='date'}>
   <{if $item.attr_value != '0-0-0' && $item.attr_value != '--'}>
   <{if $item.attr_required eq 'true'}>
    <{input class="cal" type='date' class="inputstyle" vtype="required&&date" name=$item.attr_column value=$item.attr_value}>
    <{else}>
     <{input class="cal" type='date' class="inputstyle" name=$item.attr_column value=$item.attr_value}>
    <{/if}>
    <{else}>
    <{if $item.attr_required eq 'true'}>
      <{input class="cal" type="date" class="inputstyle" vtype="required&&date" name=$item.attr_column}>
      <{else}>
         <{input class="cal" type="date" class="inputstyle" vtype="date" name=$item.attr_column}>
      <{/if}>
      <{/if}>
  <{/if}>

   <{if $item.attr_type =='region'}>
   <{input app=ectools type="region" class="inputstyle" name=$item.attr_column value=$item.attr_value }>
   <{/if}>

   <{if $item.attr_type =='gender'}>
    <{input type='gender'  name=$item.attr_column value=$item.attr_value }>
   <{/if}>

      <{if $item.attr_type =='select'}>
 <select name='<{$item.attr_column}>' <{if $item.attr_required eq 'true'}>class='_x_ipt' vtype='required'<{/if}>>
   <option value='' <{if $item.attr_value == ''}>selected='true'<{/if}>><{t}>请选择<{/t}></option>
 <{foreach from=$item.attr_option item=option name="option"}>
 <option value='<{$option}>' <{if $item.attr_value == $option}>selected='true'<{/if}>><{$option}></option>
 <{/foreach}>

 </select>
   <{/if}>

  <{if $item.attr_type =='checkbox'}>
  <{foreach from=$item.attr_option item=checkbox name="checkbox" }>



 <input type='checkbox' name=box:<{$item.attr_column}>[]" value='<{$checkbox}>' <{foreach from=$item.attr_value item=checkboxvalue name="checkboxvalue" }>
 <{if $checkboxvalue==$checkbox}>
 checked ='true'
 <{/if}>
 <{/foreach}>><label><{$checkbox}></label><br/>
   <{/foreach}><input type='hidden' name='<{$item.attr_column}>[]' value='%no%'>

<{if $item.attr_required eq 'true'}><input type='hidden' class='_x_ipt' vtype='selectc'/>
<{/if}>
   <{/if}>


   <{if $item.attr_type == 'text'}>
     <input type='text' class="inputstyle" name=<{$item.attr_column}> value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'true'}>required&&<{/if}><{$item.attr_valtype}>' />
   <{/if}>

    <{if $item.attr_type == 'number'}>
    <input type='text' class="inputstyle" name=<{$item.attr_column}> value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'true'}>required&&<{/if}><{$item.attr_valtype}>' />
   <{/if}>

  <{if $item.attr_type == 'alpha'}>
   <input type='text' class="inputstyle" name=<{$item.attr_column}> value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'true'}>required&&<{/if}><{$item.attr_valtype}>' />
   <{/if}>

</td>
  </tr>
  <{/foreach}>
  <tr>
    <th></th>
    <td>&nbsp;</td>
    </tr>
</table>
</div>
<div style="padding-left:142px"><button  class="btn submit-btn " type="submit"> <span><span> <{t}>保存<{/t}></span></span> </button></div>
</div>
  </div>
  </div>
</form>
<script>
window.addEvent('domready',function(){
validatorMap['selectc']=['<{t}>本项必填<{/t}>',function(element,value){

    var checkboxelement = element.getParent('td').getElements('input[name$=]]');
    var flag=checkboxelement.some(function(i){
	  return !!i.checked;
	});
	checkboxelement.addEvent('change',function(){
		validator.removeCaution(element);
		validator.test($('form_saveMember'),element);
		checkboxelement.removeEvent('change',arguments.callee);
	});
	return flag;
}];
});
(function(){
	var input = $(document.body).getElements('input[name=contact[area]]')[0];
	if(!input)return;
	var select = input.getNext('select');
	select.addEvent('change',function(e){
		if($(e.target).value !='_NULL_'){
			input.getParent('span').set('vtype','area');
		}
		else{
			input.getParent('span').set('vtype','');
		}
	});
})();
</script>
